<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>面板示例</title>
	
    <script type="text/javascript" src="../../dist/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="../../dist/js/jquery.hisui.js"></script>
	 <link rel="stylesheet" type="text/css" href="../../dist/css/hisui.css">
    <script type="text/javascript" src="../../dist/lib/icheck-1.x/icheck.js"></script>
    <script type="text/javascript" src="../../dist/lib/bootstrap-switch-1.8.0/static/js/bootstrap-switch.js"></script>
    <link rel="stylesheet" type="text/css" href="../demo.css">
	<script src="../jquery-tag-demo.js" type="text/javascript"></script>
</head>
<body>
	<h2>数据访问</h2>
	<h3>说明:</h3>
	<span>通过ajax调用后台方法或Query</span>
	<h3>使用:</h3>
	<span>先引入jQuery，再引入websys.jquery.js</span>
	<pre class="prettyprint lang-html">
<code>&lt;script type="text/javascript" src="../scripts_lib/jquery-easyui-1.3.2/jquery-1.8.0.min.js" charset="utf-8"&gt;&lt;/script&gt;
&lt;script src="../scripts/websys.jquery.js" type="text/javascript"&gt;&lt;/script&gt;</code></pre>
	
	<div class="demo-exp-code entry-content"> 
		<h2>$.m(data,success)调用后台方法 </h2>
		<table class="table">
			<tr class="protitle">
				<th>参数</th>
				<th>说明</th>
			</tr>
			<tr>
				<td>data</td>
				<td>		
					Object类型 调用时传的参数
					<table class="table">
						<tr >
							<th>属性</th>
							<th>说明</th>
						</tr>
						<tr>
							<td>ClassName</td>
							<td>类的完整名,即包名.类名</td>
						</tr>
						<tr>
							<td>MethodName</td>
							<td>方法名</td>
						</tr>
						<tr>
							<td>wantreturnval</td>
							<td>类方法是否有返回值。1表示有，0表示无。 默认为1</td>
						</tr>
						<tr>
							<td>其它</td>
							<td>对应类方法的入参</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>success</td>
				<td>
					Function类型 成功回调方法function(rtn){}	<br>
					当wantreturnval为1时 rtn为类方法中w输出的数据和方法返回值  <br>
					当wantreturnval为0时 rtn为类方法中w输出的数据
				</td>
			</tr>
		</table>
		<h2>示例：</h2>
		<pre class="prettyprint lang-bash">
<code >Class dhc.Test Extends %RegisteredObject
{
	///直接简单返回一个字符串
	Classmethod getPatInfo(UserName)
	{
		set str=UserName_"18岁"
		q str
	}
}</code></pre>
<pre class="prettyprint lang-js">
<code >$.m({
	ClassName:"dhc.Test",
	MethodName:"getPatInfo",
	UserName:"张三"
},function(rtn){
	alert(rtn);    //张三18岁
})</code></pre>
	</div>


	<div class="demo-exp-code entry-content"> 
			<h2>$.q(data,success)调用后台Query </h2>
			<table class="table">
				<tr class="protitle">
					<th>参数</th>
					<th>说明</th>
				</tr>
				<tr>
					<td>data</td>
					<td>		
						Object类型 调用时传的参数
						<table class="table">
							<tr >
								<th>属性</th>
								<th>说明</th>
							</tr>
							<tr>
								<td>ClassName</td>
								<td>类的完整名,即包名.类名</td>
							</tr>
							<tr>
								<td>QueryName</td>
								<td>Query名</td>
							</tr>
							<tr>
								<td>page</td>
								<td>页码，默认1</td>
							</tr>
							<tr>
								<td>rows</td>
								<td>一页记录条数，默认50</td>
							</tr>
							<tr>
								<td>其它</td>
								<td>对应Query的入参</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>success</td>
					<td>
						Function类型 成功回调方法function(rtn){}	<br>
						rtn 为easyui数据表格所需格式的json对象
					</td>
				</tr>
			</table>
			<h2>示例：</h2>
			<pre class="prettyprint lang-bash">
<code >Query LookUpActive(desc As %String) As %Library.SQLQuery(CONTAINID = 2, ROWSPEC = "Description:%String,HIDDEN:%String,Code:%String")
{
	SELECT SSUSR_Name, SSUSR_RowID, SSUSR_Initials
	FROM	SQLUser.SS_User
	WHERE	((%ALPHAUP SSUSR_Name [ %ALPHAUP :desc) OR (:desc IS NULL))
	AND	(SSUSR_Active = 'Y')
	ORDER	BY SSUSR_Name
}</code></pre>
	<pre class="prettyprint lang-js">
<code >$.q({
	ClassName:"web.SSUser",
	QueryName:"LookUpActive",
	page:1,
	rows:20
},function(rtn){
	alert(rtn);    //
	alert("total属性:"+rtn.total);
	alert("记录条数:"+rtn.rows.length);
})</code></pre>
		</div>
	<prettyprint/>
</body>
</html>